package org.flexlancer.databases
{
	public class Areas
	{
		public static const TABLE:String = "areas";

		public static function Add(areaname:String,charges:Number):void{
			try{
				var insertObj:Object = new Object();
				insertObj.areaname = areaname;
				insertObj.charges = charges;
				DatabaseManager.Manager.Insert(TABLE,insertObj);
			}catch(err:Error){
				throw err;
			}
		}

		public static function List(condition:String = ""):Array{
			try{
				return DatabaseManager.Manager.Select(TABLE,null,condition,"areaname");
			}catch(err:Error){
				throw err;
			}
			return new Array;
		}
		
		public static function Delete(condition:String = ""):void{
			try{
				DatabaseManager.Manager.Delete(TABLE,condition);
			}catch(err:Error){
				throw err;
			}
		}
		
		public static function Update(charges:Number,condition:String = ""):void{
			try{
				var updateObj:Object = new Object();
				updateObj.charges = charges;
				DatabaseManager.Manager.Update(TABLE,updateObj,condition);
			}catch(err:Error){
				throw err;
			}
		}
	}
}